import os
import pandas as pd

contents = set([])
for line in os.popen("ls recipes/*.md").read().split("\n"):
    if "/" not in line: continue
    name = line.split("/")[1].split(".")[0]
    contents.add(name)
pics = set([])
for line in os.popen("ls static/.").read().split("\n"):
    if "." in line or line.isdigit() == False: continue
    pics.add(line)

if __name__ == "__main__":
    file = pd.read_excel("allrecipes.xlsx")
    out = []
    for num in contents - pics:
        i = int(num)
        url = file.iloc[i]['URL']
        name = file.iloc[i]['菜名']
        theme = file.iloc[i]['分类']
        out.append(str(url)+"\t"+str(name)+"\t"+str(theme)+"\t"+str(i))
    with open("pic_to_load.txt","w") as f:
        f.write("\n".join(out))
